package com.belly.template.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

/**
 * @author Belly
 * @version 1.1.0
 */
@Getter
public enum FileFilterRangeEnum {
    FILE_NAME("文件名称", "fileName"),
    FILE_CONTENT("文件内容", "fileContent");

    private final String text;
    private final String value;

    FileFilterRangeEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据枚举值获得枚举
     * @param value
     * @return
     */
    public static FileFilterRangeEnum getEnumByValue(String value){
        if (ObjectUtil.isEmpty(value)){
            return null;
        }
        for (FileFilterRangeEnum rangeEnum : FileFilterRangeEnum.values()) {
            if (value.equals(rangeEnum.value)){
                return rangeEnum;
            }
        }
        return null;
    }
}
